/**
 *
 */
package cn.hg.jfsa.manage.controller.system.validator;

import cn.hg.base.jfinal.validator.BaseValidator;
import com.jfinal.core.Controller;

/**
 * @author Golly
 *
 */
public class ResourceValidator extends BaseValidator {

	/*
	 * （非 Javadoc）
	 *
	 * @see com.jfinal.validate.Validator#handleError(com.jfinal.core.Controller)
	 */
	@Override
	protected void handleError(Controller c) {
	}

	/*
	 * （非 Javadoc）
	 *
	 * @see com.jfinal.validate.Validator#validate(com.jfinal.core.Controller)
	 */
	@Override
	protected void validate(Controller c) {
		this.validateRequired("resource.parentId", "parentMsg", "必须填写上级资源！");
		this.validateRequired("resource.type", "typeMsg", "必须填写资源类型！");
		this.validateString("resource.name", 2, 50, "nameMsg", "名称必须填写2到50长度的字符！");
		this.validateInteger("resource.sortNum", 0, Short.MAX_VALUE, "sortNumMsg", "排序号必须填写0到" + Short.MAX_VALUE + "长度的字符！");
		this.validateRequired("resource.status", "statusMsg", "必须填写状态！");
	}

}
